\(\int \frac {\sqrt {a^2+2 a b x+b^2 x^2}}{x^2} \, dx\) [143]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [C] (warning: unable to verify)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 24, antiderivative size = 65 \[ \int \frac {\sqrt {a^2+2 a b x+b^2 x^2}}{x^2} \, dx=-\frac {a \sqrt {a^2+2 a b x+b^2 x^2}}{x (a+b x)}+\frac {b \sqrt {a^2+2 a b x+b^2 x^2} \log (x)}{a+b x} \]

[Out]

-a*((b*x+a)^2)^(1/2)/x/(b*x+a)+b*ln(x)*((b*x+a)^2)^(1/2)/(b*x+a)

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 65, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.083, Rules used = {660, 45} \[ \int \frac {\sqrt {a^2+2 a b x+b^2 x^2}}{x^2} \, dx=\frac {b \log (x) \sqrt {a^2+2 a b x+b^2 x^2}}{a+b x}-\frac {a \sqrt {a^2+2 a b x+b^2 x^2}}{x (a+b x)} \]

[In]

Int[Sqrt[a^2 + 2*a*b*x + b^2*x^2]/x^2,x]

[Out]

-((a*Sqrt[a^2 + 2*a*b*x + b^2*x^2])/(x*(a + b*x))) + (b*Sqrt[a^2 + 2*a*b*x + b^2*x^2]*Log[x])/(a + b*x)

Rule 45

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 660

Int[((d_.) + (e_.)*(x_))^(m_)*((a_) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> Dist[(a + b*x + c*x^2)^Fra
cPart[p]/(c^IntPart[p]*(b/2 + c*x)^(2*FracPart[p])), Int[(d + e*x)^m*(b/2 + c*x)^(2*p), x], x] /; FreeQ[{a, b,
 c, d, e, m, p}, x] && EqQ[b^2 - 4*a*c, 0] &&  !IntegerQ[p] && NeQ[2*c*d - b*e, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {\sqrt {a^2+2 a b x+b^2 x^2} \int \frac {a b+b^2 x}{x^2} \, dx}{a b+b^2 x} \\ & = \frac {\sqrt {a^2+2 a b x+b^2 x^2} \int \left (\frac {a b}{x^2}+\frac {b^2}{x}\right ) \, dx}{a b+b^2 x} \\ & = -\frac {a \sqrt {a^2+2 a b x+b^2 x^2}}{x (a+b x)}+\frac {b \sqrt {a^2+2 a b x+b^2 x^2} \log (x)}{a+b x} \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(154\) vs. \(2(65)=130\).

Time = 0.28 (sec) , antiderivative size = 154, normalized size of antiderivative = 2.37 \[ \int \frac {\sqrt {a^2+2 a b x+b^2 x^2}}{x^2} \, dx=\frac {a \sqrt {a^2}-a \sqrt {(a+b x)^2}-2 a b x \text {arctanh}\left (\frac {b x}{\sqrt {a^2}-\sqrt {(a+b x)^2}}\right )-2 \sqrt {a^2} b x \log (x)+\sqrt {a^2} b x \log \left (a \left (\sqrt {a^2}-b x-\sqrt {(a+b x)^2}\right )\right )+\sqrt {a^2} b x \log \left (a \left (\sqrt {a^2}+b x-\sqrt {(a+b x)^2}\right )\right )}{2 a x} \]

[In]

Integrate[Sqrt[a^2 + 2*a*b*x + b^2*x^2]/x^2,x]

[Out]

(a*Sqrt[a^2] - a*Sqrt[(a + b*x)^2] - 2*a*b*x*ArcTanh[(b*x)/(Sqrt[a^2] - Sqrt[(a + b*x)^2])] - 2*Sqrt[a^2]*b*x*
Log[x] + Sqrt[a^2]*b*x*Log[a*(Sqrt[a^2] - b*x - Sqrt[(a + b*x)^2])] + Sqrt[a^2]*b*x*Log[a*(Sqrt[a^2] + b*x - S
qrt[(a + b*x)^2])])/(2*a*x)

Maple [C] (warning: unable to verify)

Result contains higher order function than in optimal. Order 9 vs. order 3.

Time = 0.23 (sec) , antiderivative size = 23, normalized size of antiderivative = 0.35

method result size
default \(\frac {\operatorname {csgn}\left (b x +a \right ) \left (\ln \left (-b x \right ) b x -a \right )}{x}\) \(23\)
risch \(-\frac {a \sqrt {\left (b x +a \right )^{2}}}{x \left (b x +a \right )}+\frac {b \ln \left (x \right ) \sqrt {\left (b x +a \right )^{2}}}{b x +a}\) \(44\)

[In]

int(((b*x+a)^2)^(1/2)/x^2,x,method=_RETURNVERBOSE)

[Out]

csgn(b*x+a)*(ln(-b*x)*b*x-a)/x

Fricas [A] (verification not implemented)

none

Time = 0.64 (sec) , antiderivative size = 13, normalized size of antiderivative = 0.20 \[ \int \frac {\sqrt {a^2+2 a b x+b^2 x^2}}{x^2} \, dx=\frac {b x \log \left (x\right ) - a}{x} \]

[In]

integrate(((b*x+a)^2)^(1/2)/x^2,x, algorithm="fricas")

[Out]

(b*x*log(x) - a)/x

Sympy [F]

\[ \int \frac {\sqrt {a^2+2 a b x+b^2 x^2}}{x^2} \, dx=\int \frac {\sqrt {\left (a + b x\right )^{2}}}{x^{2}}\, dx \]

[In]

integrate(((b*x+a)**2)**(1/2)/x**2,x)

[Out]

Integral(sqrt((a + b*x)**2)/x**2, x)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 87 vs. \(2 (43) = 86\).

Time = 0.20 (sec) , antiderivative size = 87, normalized size of antiderivative = 1.34 \[ \int \frac {\sqrt {a^2+2 a b x+b^2 x^2}}{x^2} \, dx=\left (-1\right )^{2 \, b^{2} x + 2 \, a b} b \log \left (2 \, b^{2} x + 2 \, a b\right ) - \left (-1\right )^{2 \, a b x + 2 \, a^{2}} b \log \left (\frac {2 \, a b x}{{\left | x \right |}} + \frac {2 \, a^{2}}{{\left | x \right |}}\right ) - \frac {\sqrt {b^{2} x^{2} + 2 \, a b x + a^{2}}}{x} \]

[In]

integrate(((b*x+a)^2)^(1/2)/x^2,x, algorithm="maxima")

[Out]

(-1)^(2*b^2*x + 2*a*b)*b*log(2*b^2*x + 2*a*b) - (-1)^(2*a*b*x + 2*a^2)*b*log(2*a*b*x/abs(x) + 2*a^2/abs(x)) -
sqrt(b^2*x^2 + 2*a*b*x + a^2)/x

Giac [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 24, normalized size of antiderivative = 0.37 \[ \int \frac {\sqrt {a^2+2 a b x+b^2 x^2}}{x^2} \, dx=b \log \left ({\left | x \right |}\right ) \mathrm {sgn}\left (b x + a\right ) - \frac {a \mathrm {sgn}\left (b x + a\right )}{x} \]

[In]

integrate(((b*x+a)^2)^(1/2)/x^2,x, algorithm="giac")

[Out]

b*log(abs(x))*sgn(b*x + a) - a*sgn(b*x + a)/x

Mupad [B] (verification not implemented)

Time = 9.20 (sec) , antiderivative size = 103, normalized size of antiderivative = 1.58 \[ \int \frac {\sqrt {a^2+2 a b x+b^2 x^2}}{x^2} \, dx=\ln \left (a\,b+\sqrt {{\left (a+b\,x\right )}^2}\,\sqrt {b^2}+b^2\,x\right )\,\sqrt {b^2}-\frac {\sqrt {a^2+2\,a\,b\,x+b^2\,x^2}}{x}-\frac {a\,b\,\ln \left (a\,b+\frac {a^2}{x}+\frac {\sqrt {a^2}\,\sqrt {a^2+2\,a\,b\,x+b^2\,x^2}}{x}\right )}{\sqrt {a^2}} \]

[In]

int(((a + b*x)^2)^(1/2)/x^2,x)

[Out]

log(a*b + ((a + b*x)^2)^(1/2)*(b^2)^(1/2) + b^2*x)*(b^2)^(1/2) - (a^2 + b^2*x^2 + 2*a*b*x)^(1/2)/x - (a*b*log(
a*b + a^2/x + ((a^2)^(1/2)*(a^2 + b^2*x^2 + 2*a*b*x)^(1/2))/x))/(a^2)^(1/2)